import asyncio
import time

async def async_cal(llm):
    await asyncio.sleep(5)
    print("异步调用完成")


async def perform_other_tasks():
    await asyncio.sleep(5)
    print("其他任务调用完成")


async def run_async_tasks():
    start_time = time.time()
    await asyncio.gather(
        async_cal(None),
        perform_other_tasks()
    )
    end_time = time.time()
    return f"总共耗时：{end_time - start_time}"

if __name__ == "__main__":
    result = asyncio.run(run_async_tasks()) # 单线程异步调度器，它不会启动新线程，也不会用线程池，而是靠事件循环在主线程内并发执行协程。
    print(result)
